<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>将"i love javascript very much"的每个单词的第一个字母，变为大写</title>
</head>
<body>
    <script>
        function upper(c) {
            var arr = c.split(" ");
            for (var i = 0 ; i < arr.length ; i++) {
                arr[i] = arr[i].split("");
                console.log(arr)
                arr[i][0] = arr[i][0].toUpperCase();
                console.log(arr)
                arr[i] = arr[i].join("");
                console.log(arr)

            }
            return arr.join(" ")
        }
        console.log(upper('i love javascript very much'))

    </script>
</body>
</html>